/****

    activequant - activestocks.eu

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

	
	contact  : contact@activestocks.eu
    homepage : http://www.activestocks.eu

****/
package org.activequant.dao.hibernate;


import org.activequant.dao.IAccountDao;
import org.activequant.dao.IBalanceBookDao;
import org.activequant.dao.IBalanceEntryDao;
import org.activequant.dao.IBrokerAccountDao;
import org.activequant.dao.ICandleDao;
import org.activequant.dao.IFactoryDao;
import org.activequant.dao.IIndexComponentDao;
import org.activequant.dao.IIndexCompositionDao;
import org.activequant.dao.IOrderBookDao;
import org.activequant.dao.IOrderDao;
import org.activequant.dao.IQuoteDao;
import org.activequant.dao.ISpecificationDao;
import org.activequant.dao.IStoreDao;
import org.activequant.dao.ITradeIndicationDao;
import org.activequant.util.spring.ServiceLocator;


/**
 * FactoryLocatorDao implements IFactoryDao.<br/>
 * Holds the following associated variables:
 * <ul>
 * <li>locator(ServiceLocator)</li>
 * </ul>
 * <br>
 * <b>History:</b><br> 
 *  - [16.07.2007] Created (Erik Nijkamp)<br>
 *  - [10.08.2008] Added IndexComposition and IndexComponent (Wessel de Roode)<br>
 *  
 *  @author Erik Nijkamp
 */
public class FactoryLocatorDao implements IFactoryDao {
	/**
	 * private ServiceLocator locator;
	 */
	private ServiceLocator locator;
	/**
	 * Constructs a FactoryLocatorDao(implements IFactoryDao) whose associated locator(ServiceLocator) instance uses the given filename(String) to set its beanFactoryReferenceLocation(String).
	 * @param filename
	 */
	public FactoryLocatorDao(String filename) {
		this.locator = ServiceLocator.instance(filename);
	}
	/**
	 * Constructs a FactoryLocatorDao(implements IFactoryDao) using the given locator(ServiceLocator) to set its associated locator(ServiceLocator)
	 * @param locator
	 */
	public FactoryLocatorDao(ServiceLocator locator) {
		this.locator = locator;
	}
	/**
	 * Returns a bean(IStoreDao) instance of the first Bean of type <code>IStoreDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public IStoreDao createStoreDao() {
		return locator.getService(IStoreDao.class);
	}
	/**
	 * Returns a bean(IAccountDao) instance of the first Bean of type <code>IAccountDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public IAccountDao createAccountDao() {
		return locator.getService(IAccountDao.class);
	}
	/**
	 * Returns a bean(IBrokerAccountDao) instance of the first Bean of type <code>IBrokerAccountDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public IBrokerAccountDao createBrokerAccountDao() {
		return locator.getService(IBrokerAccountDao.class);
	}
	/**
	 * Returns a bean(IQuoteDao) instance of the first Bean of type <code>IQuoteDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public IQuoteDao createQuoteDao() {
		return locator.getService(IQuoteDao.class);
	}
	/**
	 * Returns a bean(ICandleDao) instance of the first Bean of type <code>ICandleDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public ICandleDao createCandleDao() {
		return locator.getService(ICandleDao.class);
	}
	/**
	 * Returns a bean(IOrderDao) instance of the first Bean of type <code>IOrderDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public IOrderDao createOrderDao() {
		return locator.getService(IOrderDao.class);
	}
	/**
	 * Returns a bean(ISpecificationDao) instance of the first Bean of type <code>ISpecificationDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public ISpecificationDao createSpecificationDao() {
		return locator.getService(ISpecificationDao.class);
	}
	/**
	 * Returns a bean(ITradeIndicationDao) instance of the first Bean of type <code>ITradeIndicationDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public ITradeIndicationDao createTradeIndicationDao() {
		return locator.getService(ITradeIndicationDao.class);
	}
	/**
	 * Returns a bean(IOrderBookDao) instance of the first Bean of type <code>IOrderBookDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public IOrderBookDao createOrderBookDao() {
		return locator.getService(IOrderBookDao.class);
	}
	/**
	 * returns <code>null</code>
	 */
	public IBalanceBookDao createBalanceBookDao() {
		// TODO Auto-generated method stub
		return null;
	}
	/**
	 * returns <code>null</code>
	 */
	public IBalanceEntryDao createBalanceEntryDao() {
		// TODO Auto-generated method stub
		return null;
	}
	/**
	 * Returns a bean(IIndexCompositionDao) instance of the first Bean of type <code>IIndexCompositionDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public IIndexCompositionDao createIndexCompositionDao() {
		
		return locator.getService(IIndexCompositionDao.class);
	}
	/**
	 * Returns a bean(IIndexComponentDao) instance of the first Bean of type <code>IIndexComponentDao.class</code> in the ApplicationContext of the associated locator(ServiceLocator).
	 */
	public IIndexComponentDao createIndexComponentDao() {
		return locator.getService(IIndexComponentDao.class);
	}
}
